<admintpl file="header"/>
<body class="J_scroll_fixed">
<div class="wrap J_check_wrap">
  <ul class="nav nav-tabs">
     <li class="active"><a href="{:U('Ballbar/index')}">球帖列表</a></li>
     <li><a href="{:U('Ballbar/add')}">发布球帖</a></li>
  </ul>
		<form class="well form-search" method="post" action="{:U('Ballbar/index')}">
			<div class="search_type cc mb10">
				<div class="mb10">
					<span class="mr20">板块列表： 
	              	<select id="province"name="typeclass" class="normal_select index_select"> 
								<option value="0">全部</option>
		        		<foreach name="forumsections" item="vo">
		        			<if condition="$formpost['typeclass'] eq $vo['id']">
			        			<option selected="selected" value="{$vo.id}">{$vo.sectiontitle}</option>
			        			<else />
			        			<option value="{$vo.id}">{$vo.sectiontitle}</option>
		        			</if>
		                </foreach>
	               	</select>搜索：
						<input type="text" name="seach" value="{$formpost.seach}"  style="width: 80px;">
	               	</select>用户ID：
						<input type="text" name="userid" value="{$formpost.userid}"  style="width: 80px;"> &nbsp; &nbsp;
						发布日期：
						<input type="text" name="start_time" value="{$formpost.start_time}" class="J_date" style="width: 80px;">-
						<input type="text" name="end_time" value="{$formpost.end_time}" class="J_date" style="width: 80px;"> &nbsp; &nbsp;
						<input type="submit" class="btn btn-primary" value="搜索" />
						<if condition="$num neq 0">
							共有 {$num} 条相关记录
						</if>
					</span>
				</div>
			</div>
		</form>
  <form class="form-horizontal J_ajaxForm" action="{:U('Ballbar/index')}" method="post">
    <div class="table_list">
      <div class="p10"><div class="pages"> {$Page} </div> </div>
      <table width="100%" class="table table-hover">
        <thead>
          <tr>
            <th width="50">ID</th>
            <th>所属板块</th>
            <th>ID：用户昵称</th>
            <th>标题</th>
            <th>内容</th>
            <th>商品/状态</th>
            <th width="60">操作</th>
          </tr>
        </thead>
        <foreach name="lists" item="vo">
        	<tr>
				<td>{$vo.id}</td>
		        <td>
		        		<foreach name="forumsections" item="forumsection">
		        			<if condition="$vo['parentid'] eq $forumsection['id']">
			        			{$forumsection.sectiontitle}
		        			</if>
		            </foreach>
		        </td>
						<td class='emoji'>
								{$vo.userid}：
		        		<foreach name="users" item="user">
		        			<if condition="$vo['userid'] eq $user['id']">
									<php> 
										$base64 = $user['nickname'];
								 	echo $base64 = preg_replace_callback ( '/@E(.{6}==)/', function ($r) {
													return base64_decode ( $r [1] );
											}, $base64 );
										$uid = $user['id'];
									</php>
		        			</if>
		          	</foreach>
		          <br>{$vo.modified}
		        </td>
				<td>
					{$vo.title}<br>
				<php>$i=$j=0;</php>
		        		<foreach name="parents" item="parent">
		        			<if condition="$parent['parentid'] eq $vo['id']">
			        			<php>$i++;</php>
		        			</if>
		            </foreach>
		            <a href="{:U('ballbar/view',array('id'=>$vo['id']))}">评论（{$i}）</a>
		        		<foreach name="favorites" item="favorite">
		        			<if condition="$favorite['relatedid'] eq $vo['id']">
			        			<php>$j++;</php>
		        			</if>
		            </foreach>
		            <a href="{:U('ballbar/attention',array('id'=>$vo['id']))}">点赞（{$j}）</a>
				</td>
				<td>{$vo.description|msubstr=0,32}</td>
			        	<php>$n=0;</php>
				<td>
    			<if condition="$vo['itemid']">
        			商品ID：<a href="{:U('shop/edit',array('id'=>$vo['itemid']))}">{$vo.itemid}</a>
						 | <a href="{:U('ballbar/shop',array('id'=>$vo['id']))}" title="修改关联">修改</a> | 
						<a href="{:U('ballbar/cancel',array('id'=>$vo['id']))}" title="取消关联" class="J_ajax_dialog_btn" data-msg="您确定要取消关联吗？">取消</a>
					<else />
            		<a href="{:U('ballbar/shop',array('id'=>$vo['id']))}">关联商品</a>
    			</if>
				<br>
					<if condition="$vo['status'] elt 100">
						<a href="{:U('ballbar/openbar',array('id'=>$vo['id']))}" class="J_ajax_dialog_btn" data-msg="您确定要开启此帖吗？"style="color: #FF0000;"><b>已关闭</b></a>
					<else />
						<a href="{:U('ballbar/closebar',array('id'=>$vo['id']))}" class="J_ajax_dialog_btn" data-msg="您确定要关闭此帖吗？">未关闭 </a>
					</if>
            | <a href="{:U('ballbar/refresh',array('id'=>$vo['id']))}" class="J_ajax_dialog_btn" data-msg="您确定要刷新发布时间吗？">刷新</a>
					<!--
						<php>
						$x=0;
						for($i=0;$i<count($bets);$i++){
							if($bets[$i]['description'] ==$vo['id'] ){
								for($j=0;$j<count($matchs);$j++){
									if($matchs[$j]['matchconstid'] ==$bets[$i]['matchinfoid'] ){
										echo "赛事ID：".$matchs[$j]['matchconstid'];
										echo $matchs[$j]['matchdesc'].'<br>';
										for($k=0;$k<count($teams);$k++){
											if($matchs[$j]['teamid1'] ==$teams[$k]['constid'] ){
												echo $teams[$k]['teamname'].' : ';
											}
										}
										for($l=0;$l<count($teams);$l++){
											if($matchs[$j]['teamid2'] ==$teams[$l]['constid'] ){
												echo $teams[$l]['teamname'];
											}
										}
										$x++;
									}
								}
							}
						}				
					</php>
					<if condition="$x lt 1">
            			<a href="{:U('ballbar/associate',array('id'=>$vo['id']))}">关联猜球</a>
					<else />
						<a href="{:U('ballbar/associate',array('id'=>$vo['id']))}" title="修改关联">修改</a>
					</if>
					<br>
					<if condition="$vo['status'] eq 1000">
						<a href="{:U('ballbar/downbar',array('id'=>$vo['id']))}" class="J_ajax_dialog_btn" data-msg="您确定要取消置顶此帖吗？"style="color: #FF0000;"><b>已置顶</b></a>
					<else />
						<a href="{:U('ballbar/upbar',array('id'=>$vo['id']))}" class="J_ajax_dialog_btn" data-msg="您确定要置顶此帖吗？">未置顶 </a>
					</if>
					<br>
					<if condition="$vo['status'] eq 10000">
						<a href="{:U('ballbar/nothotbar',array('id'=>$vo['id']))}" class="J_ajax_dialog_btn" data-msg="您确定要取消此热帖吗？"style="color: #FF0000;"><b>热帖</b></a>
					<else />
						<a href="{:U('ballbar/hotbar',array('id'=>$vo['id']))}" class="J_ajax_dialog_btn" data-msg="您确定要设为热帖吗？">非热帖 </a>
					</if>-->
        	</td>
        	<td>
        		<a href="{:U('ballbar/edit',array('id'=>$vo['id'],'p'=>$_GET['p'],'c'=>$formpost['typeclass']))}">修改</a> | 
        		<a href="{:U('ballbar/reply',array('id'=>$vo['id'],'p'=>$_GET['p'],'c'=>$formpost['typeclass']))}">回复</a>
						<br />
						<a href="{:U('ballbar/thumbs',array('id'=>$vo['id']))}" class="J_ajax_dialog_btn" data-msg="您确定要为帖子加十个赞吗？">加十个赞</a>
          </td>
			</tr>
        </foreach>
        <thead>
          <tr>
            <th width="50">ID</th>
            <th>所属板块</th>
            <th>ID：用户昵称</th>
            <th>标题</th>
            <th>内容</th>
            <th>商品/状态</th>
            <th width="60">操作</th>
          </tr>
        </thead>
      </table>
      <div class="p10"><div class="pages"> {$Page} </div> </div>
    </div>
  </form>
</div>
<script type="text/javascript" src="__ROOT__/statics/js/common.js"></script>
<script type="text/javascript" src="__ROOT__/statics/js/content_addtop.js"></script>
<script>
setCookie('refersh_time', 0);
function refersh_window() {
    var refersh_time = getCookie('refersh_time');
    if (refersh_time == 1) {
        window.location.reload();
    }
}
setInterval(function(){
	refersh_window()
}, 2000);
$('.emoji').emoji();
</script>
</body>
</html>